home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 February / macformat-047.iso / Shareware Plus / Developers / PlayerPRO 4.5.3 Dev.Kit / MADH Library 4.2 / Libraries & Headers / PPPlug.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-02  |  9.1 KB  |  254 lines  |  [TEXT/CWIE]

  1. #ifndef __PPPLUGH__
  2. #define __PPPLUGH__
  3.  
  4. #ifndef __RDRIVERH__
  5. #include "RDriver.h"
  6. #endif
  7.  
  8. #if defined(powerc) || defined (__powerc)
  9. #pragma options align=mac68k
  10. #else
  11. #if !defined(THINK_C)
  12. #pragma options align=mac68k
  13. #endif
  14. #endif
  15.  
  16.  
  17. /********************                        ***********************/
  18. //
  19. //    Player PRO 4.5x --    Plugs SOUND FILTERS Definition
  20. //                        Plugs DIGITAL EDITOR Definition
  21. //                        Plugs INSTRUMENTS IMPORT/EXPORT Definition
  22. //
  23. //    Version 3.0
  24. //
  25. //    To use with PlayerPRO & CodeWarrior ( current vers 8)
  26. //
  27. //    Antoine ROSSET
  28. //    16 Tranchees
  29. //    1206 GENEVA
  30. //    SWITZERLAND
  31. //    
  32. //    FAX:            (+41 22) 346 11 97
  33. //    Compuserve:        100277,164
  34. //    Phone:            (+41 79) 203 74 62
  35. //    Internet:         rosset@dial.eunet.ch
  36. /********************                        ***********************/
  37.  
  38.  
  39.  
  40. /******************************************************************/
  41. //    *****************    FILTERS FOR SAMPLES/SOUNDS    ***************/
  42. //
  43. //    Your main function have to be in this form:
  44. //    OSErr main(     sData                    *theData,                    // Sample informations, see MAD.h
  45. //                    long                    SelectionStart,                // SelectionStart 
  46. //                    long                    SelectionEnd,                // SelectionEnd, your filter SHOULD apply his effect only on the selection
  47. //                    PPInfoPlug                *thePPInfoPlug)                // Some functions of PlayerPRO that you can use in your plugs
  48. //
  49. //
  50. //    *****************                        ***********************/
  51. //
  52. //    If you want to reallocate theData or theData->data:
  53. //    
  54. //    if( theData->data != 0L) DisposPtr( theData->data);        // VERY IMPORTANT to free memory
  55. //    theData->data = NewPtr( newsize);                        // Use NewPtr ONLY to allocate memory!
  56. //    
  57. //    theData->size = newsize;                                // In bytes !! Even for 16 bits !
  58. //    
  59. //    Don't forget to UPDATE the theData->size !!!!!!!!!!!!
  60. //
  61. //    *****************                        ***********************/
  62. //
  63. //    About Resources:
  64. //
  65. //    Your Plug should have: Creator: 'SNPL', Type: 'PLug'
  66. //
  67. //    Your Plug have to have these resources:
  68. //
  69. //    - One resource CODE 1000 with 68k Code  ** You should NOT use the 68881 coprocessor **
  70. //    - One resource PPCC 1000 with PPC Code  (OPTIONAL: if PlayerPRO PPC version cannot find it, it will use the CODE 1000 68k resource)
  71. //    - One STR# resource :
  72. //
  73. //        1 string: Menu Name (see Instrument window in PlayerPRO)
  74. //
  75. /********************                        ***********************/
  76.  
  77. typedef struct
  78. {
  79.     void        *RPlaySoundUPP;            //    OSErr            RPlaySound( Ptr whichSound, long SoundSize, long whichTrack, long Period, long Amplitude, long loopStart, long loopLength)
  80.     void        *UpdateALLWindowUPP;    //    void            UpdateALLWindow( void)
  81.     void        *MyDlgFilterUPP;        //    pascal Boolean    MyDlgFilter( DialogPtr theDlg, EventRecord *theEvt, short *itemHit)
  82.     
  83. } PPInfoPlug;
  84.  
  85. typedef OSErr            (*RPlaySoundUPP)        ( Ptr, long, long, long, long, long, long, unsigned long);
  86. typedef void            (*UpdateALLWindowUPP)    ( void);
  87. typedef pascal Boolean    (*MyDlgFilterUPP)        ( DialogPtr, EventRecord*, short*);
  88.  
  89.  
  90. #if defined(powerc) || defined(__powerc)
  91.  
  92. #include "mixedmode.h"
  93.  
  94.         /****** POWERPC calls *********/
  95.  
  96. #define         RPlaySoundCallMode (    kCStackBased|\
  97.                 RESULT_SIZE( SIZE_CODE( sizeof(OSErr) ))|\
  98.                 STACK_ROUTINE_PARAMETER( 1, SIZE_CODE( sizeof( Ptr)))|\
  99.                 STACK_ROUTINE_PARAMETER( 2, SIZE_CODE( sizeof( long)))|\
  100.                 STACK_ROUTINE_PARAMETER( 3, SIZE_CODE( sizeof( long)))|\
  101.                 STACK_ROUTINE_PARAMETER( 4, SIZE_CODE( sizeof( long)))|\
  102.                 STACK_ROUTINE_PARAMETER( 5, SIZE_CODE( sizeof( long)))|\
  103.                 STACK_ROUTINE_PARAMETER( 6, SIZE_CODE( sizeof( long)))|\
  104.                  STACK_ROUTINE_PARAMETER( 7, SIZE_CODE( sizeof( long)))|\
  105.                  STACK_ROUTINE_PARAMETER( 8, SIZE_CODE( sizeof( unsigned long))))
  106.                  
  107. #define CallRPlaySoundUPP( v1, v2, v3, v4, v5, v6, v7, v8)        \
  108.         CallUniversalProc( thePPInfoPlug->RPlaySoundUPP, RPlaySoundCallMode, v1, v2, v3, v4, v5, v6, v7, v8)
  109.  
  110. /**/
  111.  
  112. #define UpdateALLWindowCallMode (    kCStackBased)
  113.  
  114. #define CallUpdateALLWindowUPP()        \
  115.         CallUniversalProc( thePPInfoPlug->UpdateALLWindowUPP, UpdateALLWindowCallMode)
  116.  
  117. /**/
  118.  
  119. #else    /******** 68K calls ***********/
  120.  
  121. #define CallRPlaySoundUPP( v1, v2, v3, v4, v5, v6, v7, v8)        \
  122.         (* (RPlaySoundUPP) (thePPInfoPlug->RPlaySoundUPP))( v1, v2, v3, v4, v5, v6, v7, v8)
  123.  
  124. /**/
  125.  
  126. #define CallUpdateALLWindowUPP()        \
  127.         (* (UpdateALLWindowUPP) (thePPInfoPlug->UpdateALLWindowUPP))
  128.  
  129. /**/
  130. #endif
  131.  
  132. /********************                        ***********************/
  133. //
  134. //
  135. // RPlaySoundUPP    : See Developper Toolkit documentation. Play a SoundPtr at a specific Period by using PlayerPRO Driver.
  136. // UpdateALLWindow    : Check all PlayerPRO windows and update them if need it.
  137. // MyDlgFilterUPP    : to use with a ModalDialog function: allow movable dialog, PlayerPRO windows updating, Item 1 Frame, Copy/Paste support, Key support
  138. //
  139. //
  140. /********************                        ***********************/
  141.  
  142.  
  143. /******************************************************************/
  144. //******************* DIGITAL EDITOR PLUGS  ***********************/
  145. //
  146. //    Your main function have to be in this form:
  147. //    OSErr main(     Pcmd                    *Pcmd,                        // Digital Selection
  148. //                    PPInfoPlug                *thePPInfoPlug)                // Some functions of PlayerPRO that you can use in your plugs
  149. //
  150. //
  151. //    *****************                        ***********************/
  152. //
  153. //    If you want to reallocate Pcmd:
  154. //    
  155. //    if( Pcmd != 0L) DisposPtr( (Ptr) Pcmd);                            // VERY IMPORTANT
  156. //    Pcmd = NewPtrClear( sizeof( Pcmd) + noCell * sizeof( Cmd));        // Use NewPtr ONLY to allocate memory!
  157. //
  158. //    myPcmd->structSize     = sizeof( Pcmd) + noCell * sizeof( Cmd);
  159. //    
  160. //    Don't forget to UPDATE the myPcmd->structSize !!!!!!!!!!!!
  161. //
  162. //    *****************                        ***********************/
  163. //
  164. //    About Resources:
  165. //
  166. //    Your Plug should have: Creator: 'SNPL', Type: 'PPDG'
  167. //
  168. //    Your Plug have to have these resources:
  169. //
  170. //    - One resource CODE 1000 with 68k Code  ** You should NOT use the 68881 coprocessor **
  171. //    - One resource PPCC 1000 with PPC Code  (OPTIONAL: if PlayerPRO in PPC cannot find it, it will use the CODE 1000 resource)
  172. //    - One STR# resource :
  173. //
  174. //        1 string: Menu Name (see Button in Digital Editor window in PlayerPRO)
  175. //
  176. /********************                        ***********************/
  177.  
  178. typedef struct
  179. {
  180.     short            tracks;                    // number of tracks in myCmd[]
  181.     short            length;                    // number of rows in myCmd[]
  182.     short            trackStart;                // track ID of first track in myCmd[]
  183.     short            posStart;                // row ID of first row in myCmd[]
  184.     long            structSize;                // struct size in bytes - see Definition
  185.     Cmd                myCmd[];
  186. } Pcmd;
  187.  
  188. /******************************************************************/
  189. //******************* INSTRUMENTS IMPORT/EXPORT PLUGS  ************/
  190. //
  191. //    Your main function have to be in this form:
  192. //    OSErr main(     OSType                    order,                        // Order to execute
  193. //                    InstrData                *InsHeader,                    // Ptr on instrument header
  194. //                    sData                    **sample,                    // Ptr on samples data
  195. //                    short                    *sampleID,                    // If you need to replace/add only a sample, not replace the entire instrument (by example for 'AIFF' sound)
  196. //                                                                        // If sampleID == -1 : add sample else replace selected sample.
  197. //                    FSSpec                    *AlienFile,                    // IN/OUT file
  198. //                    PPInfoPlug                *thePPInfoPlug)                // Some functions of PlayerPRO that you can use in your plugs
  199. //
  200. //
  201. //    *****************                        ***********************/
  202. //    Actual plug have to support these orders:
  203. //
  204. //    order: 'TEST':    check the AlienFile to see if your Plug really supports it.
  205. //    order: 'IMPT':    convert the AlienFile into a PlayerPRO instrument. You have to allocate/dispose your sData*. NOT InsHeader!
  206. //    order: 'EXPT':    Convert current instrument&samples into a file.
  207. //    order: 'PLAY':    Play the sound file at base note via PlayerPRO driver in SYNC.
  208. //    *****************                        ***********************/
  209. //
  210. //    About Resources:
  211. //
  212. //    Your Plug should have: Creator: 'SNPL', Type: 'PPIN'
  213. //
  214. //    Your Plug have to have these resources:
  215. //
  216. //    - One resource CODE 1000 with 68k Code  ** You should NOT use the 68881 coprocessor **
  217. //    - One resource PPCC 1000 with PPC Code  (OPTIONAL: if PlayerPRO in PPC cannot find it, it will use the CODE 1000 resource)
  218. //    - One STR# resource :
  219. //
  220. //
  221. //        1 string: which kind of files your plug support (OSType value !!! 4 char) By example: 'WAVE', 'snd ', 'AIFF', etc...
  222. //        2 string: what does your Plug: EXPL : only Export files, IMPL : only Import Files, EXIM : import AND export.
  223. //        3 string: string that will be used in Import and Export menu of PlayerPRO
  224. //        4 string: Copyright string of this plug.
  225. //        5 string: Is it a sample or an instrument format? 'INST' or 'SAMP'
  226. //
  227. /********************                        ***********************/
  228.  
  229. OSErr    PPINImportFile( OSType    kindFile, short ins, short *samp, FSSpec    *AlienFile);
  230. OSErr    PPINTestFile( OSType    kindFile, FSSpec    *AlienFile);
  231. OSErr    PPINExportFile( OSType    kindFile, short ins, short samp, FSSpec    *AlienFile);
  232. OSType    PressPPINMenu( Rect    *PopUpRect, OSType curType, short, Str255);
  233. OSErr    PPINAvailablePlug( OSType    kindFile, OSType *plugType); // plugType == 'INST' or 'SAMP'
  234. OSErr    PPINGetPlugByID( OSType *type, short id, short samp);
  235.  
  236.  
  237. // SndUtils.c Definition :
  238.  
  239. sData*    MADCreateSample();
  240. OSErr    AddSoundToMAD(    Ptr, long, long, short, short, unsigned long, Str255, InstrData*, sData**, short*);
  241. Ptr     MyExp1to6( Ptr sound, unsigned long numSampleFrames);
  242. Ptr     MyExp1to3( Ptr sound, unsigned long numSampleFrames);
  243. void     ConvertInstrumentIn( register    Byte    *tempPtr,    register long sSize);
  244.  
  245.  
  246.  
  247. #if defined(powerc) || defined (__powerc)
  248. #pragma options align=reset
  249. #else
  250. #if !defined(THINK_C)
  251. #pragma options align=reset
  252. #endif
  253. #endif
  254. #endif